{{mcrozier:durisian_pbx_3a.jpg?600x*}}


======Introduction======
**PEDAL BOX / PEDAL BOARD 1.0 IS NOW AVAILABLE**

**Pedal Box**
 <box 253px right round>
{{mcrozier:durisian_pbx_2.jpg?220x*}}
</box>
Is an expression pedal controller to expand an existing floorboard. \\ 
In addition to adding up to 8 expression pedals, The LCD display reflects the actions of the floorboard as well.

**Pedal Board**
 <box 253px right round>
{{mcrozier:pedal_board_max.jpg?220x*}}\\ 
Expanding into Pedal Board - you can build a complete MIOS Powered Floorboard.</box>
Is a complete MIOS/MBHP powered floorboard. It can support up to 16 buttons, with banks so there is up to 128 possibilities. \\ 
//No matter how many buttons you connect, you can always access all 128 midi commands// \\ 
It also supports another 16 fixed buttons, that are the same regardless of bank. Great for boost, or effect on/off functions. \\ 
A further 2 special function buttons allow bank up/down and special functions. \\ 
And of course 8 expression pedals.

Each button or pedal can be assigned to a specific device, up to 8 devices can be controlled over 8 midi channels.

Pedal Box / Pedal Board features an extensive display system; \\ 
Program changes can be named, controls can be named, and can also display on/off, a meter showing approximate position for pedals. It can display tap tempo rate, or even the name of a value for a control - eg. For an Amp model select CC, it can display the model name selected.

Developed by [[Durisian]] - The Pedal Box was built to be a very basic extension to a floorboard. Giving it an extra 8 Expression Pedals, and a display to see patch change / CC names, as well as their values.
It has grown far beyond it's original intention. 











=====Features=====

  * 8 Expression Pedals or Pedal inputs (CV / 10k pot)
    * Individual option for pedals to follow program change messages changing the midi messages sent
    * Value scaled between pre-defined min and max values (can also be different for each program change)
  * LCD Display
    * Named Program Changes
    * Named CC events
    * Bar Graph displaying value/on/off
    * up to 9 specific CC value name tables for effect selection, etc
    * Tap Tempo BPM display
  * Optional Pedal Board mode (max 34 buttons)
    * Up to 16 fixed midi output buttons with LED indicators
    * Up to 16 banked buttons for up to 128 midi commands with 16 LED indicators
    * Buttons toggle between a pre-defined min and max value
    * 2 modes for buttons: switching or momentary
    * Bank displayed on 2x7 segment LED digits or LCD 
    * Bank Up / Down buttons
  * Can be setup to control up to 8 devices (1 bankstick required per device)
    * Each pedal or button has it's own device assignment
  * Individual 'device tables' files allows easy...ish customization for different MIDI devices. 
  * Settings configurable from box. (this is a very slow process but can you help you out in pinch, it's far quicker to edit the default setup before uploading). \\ 
//There are 3620 editable parameters from the box// 


=====LCD Display=====
<box 320px left>{{mcrozier:durisian_pbx_1.jpg?300x*}}
 \\ 
 \\ 
 \\ 
 \\ 
 \\ 
 \\ 
 \\ 
 \\ 
 \\ 
 \\ 
</box> \\ 
Here are some examples of what is displayed on the LCD. \\ 

{{mcrozier:pbx_programchange2.jpg}} Program changes \\ 
{{mcrozier:pbx_cc_screen.jpg}} Controllers\\ 
{{mcrozier:pbx_pan_screen.jpg}} Controllers\\ 
{{mcrozier:pbx_value_screen.jpg}} Controllers\\ 
{{mcrozier:pbx_map_screen.jpg}} Controllers\\ 
{{mcrozier:pbx_button_screen.jpg}} On/Off controls\\ 
{{mcrozier:pbx_tap_screen.jpg}} Tap Tempo Display\\ 



=====Setup Examples=====
<box 33% left|Pedal Box>
FIXME
</box>
<box 33% left|Pedal Board>
FIXME
</box>
<box 33% left|Extreme>
FIXME
</box>

======Manual======
[[pedal_box:manual]]

======Building Pedal Box / Pedal Board======

=====Software=====

Pedal Box / Pedal Board has been written in C for PIC18F452. \\  


===Current Limitations===  
  * Requires patch name changes in the pre loaded event table. BEFORE it's loaded





====Installing====
Firstly your PIC must be setup with bootloader and MIOS 1.9 or higher. \\ 
You should be familiar with compliling 'C' and 'assembler' files for MIOS. \\ 
As well as uploading files to the Core module. See http://www.ucapps.de/

===Uploading device information===

Specific device information are located in .asm files. These need to be edited as needed and complied using mplab.

In these files:
   * The device name
   * The default MIDI channel
   * The Event Map
      * MIDI event name, status, parameter 1 and event type
      * 256 Entries (usually 128 CC's, 128 program changes)
   * 9 x Parameter 2 value maps
      * Value name and associated value
      * Up to 128 entries each (1 for each value, does not need all entries)
   * 8 x Pedal Settings (1 for each pedal)
      * Event Map entry number, minimun value, maximum value
      * 128 entries each (1 for each program change)
   * Whether or not pedals change midi event sent with program changes
   * Button settings
      * Event Map entry number, minimun value, maximum value and whether it's switching or momentary
      * 144 entries (16 for fixed buttons + 128 for banked buttons) \\ 


Once complied, you can use MIOS Studio to upload the created .hex file to a bankstick

WARNING It may take many hours to set up these tables to suit yourself!

Later on you may wish to update the event map, and value maps without changing your setup. \\ 
Simply delete the AIN and DIN maps from the .asm file (be sure to (save AS, you don't want to overwrite the complete file) and re-compile.

===Uploading Pedal Box / Pedal Board===
Now we are ready to upload Pedal Box. Browse to your Pedal Box directory and open the main.h file. \\ 
You need to customise the application here. Comments inside in main.h will tell you what each setting does.

Once you've customised the application it needs to be recompiled. Simply run make.bat.

Upload the created project.hex (or .syx) file to the core module. MIOS will now reboot, and that's it!

==Example of main.h setup==
This is an example configured for:
   * 8 expresson pedals, 3 fixed buttons and 3 banked buttons. \\ 
   * There are 2 LED digits connected to shift register 2 and 3 (start at pin 8). \\ 
   * There could also be 6 LED indicators for the buttons. \\ 
   * Bank down is at pin 6, bank up at pin 7. \\ 
   * Special buttons for setup modes are the same as the first 2 fixed buttons. \\ 
   * 3 special midi commands for setup modes are cc127, with values of 127, 126, and 125. \\ 

<code c>
///////////////////////////////////////////////////////////////////////////
// Global Parameters
//
///////////////////////////////////////////////////////////////////////////

#define   PEDALBOARD             1  // 1 = Pedal Board mode    0 = Pedal Box mode
#define   MIDI_MERGER            0  // 0 = off   1 = on

 // Input Parameters
#define   AIN_DEADBAND           7 // 7 for 7-bit midi is best
#define   AIN_NUMBER_INPUTS      8 // 1 - 8 - number of pots connected

#define   NUMBER_OF_SRIO         3 // 1-16  number of shift registers connected (count DIN or DOUT,
                                   //  whichever has more)
#define   DIN_DEBOUNCE_VALUE     20 // debounce value

// FIXED BUTTONS MUST CONNECT FIRST
#define   DIN_FIXED_BUTTONS      3 // 0-16 buttons that always stay the same, regardless of bank

// BANKED BUTTONS MUST BE CONNECTED AFTER FIXED BUTTONS
#define   DIN_BANKED_BUTTONS     3 // 0-16 buttons that change with bank. 
                                   // 1 banked button will cause display errors when bank is over 99

 //THESE SPECIAL FUNCTION BUTTONS MUST BE CONNECTED AFTER THE BANKED BUTTONS!!!!!!!
#define   DIN_BANK_UP            6   // 2 - 34, pin number of button used to bank up
#define   DIN_BANK_DOWN          7   // 2 - 34, pin number of button used to bank down

#define   EVENT_SETUP_DIN_PIN    0   // 0 - 34, pin number of button used to enter event setup
#define   GLOBAL_SETUP_DIN_PIN   1   // 0 - 34, pin number of button used to enter AIN setup

// Enter setup with MIDI event
#define   EVENT_SETUP_E0        0xb0 // 0x90 - 0xef - Status
#define   EVENT_SETUP_E1        0x7f // 0x00 - 0x7f - Param1
#define   EVENT_SETUP_E2        0x7f // 0x00 - 0x7f - Param2

// Global setup with MIDI event
#define   GLOBAL_SETUP_E0       0xb0 // 0x90 - 0xef - Status
#define   GLOBAL_SETUP_E1       0x7f // 0x00 - 0x7f - Param1
#define   GLOBAL_SETUP_E2       0x7d // 0x00 - 0x7f - Param2

// Screen change with MIDI event
#define   SCREEN_CHANGE_E0      0xb0 // 0x90 - 0xef - Status Byte
#define   SCREEN_CHANGE_E1      0x7f // 0x00 - 0x7f - Param1 Byte
#define   SCREEN_CHANGE_E2      0x7e // 0x00 - 0x7f - Param2 Byte

  //LED Digit Setup (Pedal Board mode only)
#define   DIGITS_CONNECTED       2  // 0-2 How many LED digits are connected
#define   DOUT_DIGITS_START      8  // 0,8,16,24,32 What DOUT pin do the digits start from.
                                    // Must be multiple of 8 and higher than DIN_FIXED_BUTTONS
                                    // Or conflict with LED indicator handler will occur
                                    // Unless LED indicators are disabled
#define   USE_LED_INDICATORS     1  // Enable LED indicators connected 1 = Enabled 0 = Disabled
</code>









====Download====
<box 48% left round|Application>
[[http://members.iinet.net.au/~mcrozier/MIDIBox/pbx_1.0.rar |Pedal Box / Pedal Board v1.0]] \\ 
</box><box 48% right round bluedark|MIDI Device Downloads>
  * {{mcrozier:pbx_device_lxpro.zip|Behringer V-Amp 2 / V-Amp Pro / V-Ampire}}
  * {{mcrozier:pbx_device_pod2.zip|Line 6 POD 2.0 / POD Pro}}
More to come! \\ 

Skeleton is included in main package to make your own device tables \\ 
//(if you do - pm me in the forum and i'll include it here)//  \\ 
</box>
----










====Known Bugs====
  * MIOS Studio reports errors during device uploads. Although they upload fine.






====History====
  * 1.0
    * Speed issues fixed
    * Added internal eeprom clear (hold bank up + bank down at startup)
    * General code cleanup, renamed a lot of variables to make it easier to understand
    * Fixed issue with un-fixed AIN not affecting led indicators

  * beta2.0
    * Startup now displays bank properly
    * MIDI Input works from startup
    * LED indicators now working as planned for all scenario's (i think)
    * LED indicators react to AIN, DIN and MIDI input

  * beta1.16a
    * Bug Fix: Buttons now toggle correctly when low value is above zero

  * beta1.16
    * Display of MIDI input is suspended for 10ms when a program change is recieved, this prevents CC messages that may also be sent at the same time from overiding the display

  * beta1.15
    * Multiple bankstick led indicators work correctly
    * Pedals in fixed mode now save correctly
    * Pedals in non-fixed mode are no longer... fixed

  * beta1.14 
    * Multiple Bankstick MIDI input bug fixed
    * led indicators for program change work properly

  * beta1.13
    * Added pan display handler
    * Added value display handler
    * Improved device file readability

  * beta1.12
    * Minor display bugs fixed
    * Program mode now working correctly for Pedal Box
    * Channel now displays as 1-16 instead of 0-15

  * beta1.1
    * Cleaned up code
    * Added multiple device/bankstick support
    * Added channel select options

  * beta1.0
    * Initial Beta Release

=====Hardware=====

====Minimum Setup====
  * 1 x Core Module (PIC18F452) \\ 
  * 1 x 16x2 LCD Display
  * 1 x 24LC256 Bankstick
  * 1 x CV Pedal (or pot)
  * A MIDI Floorboard / HUI **OR** 1xDINX1 Module and 4 buttons //- Required for editing settings after upload//





====Analog inputs====
<box 170px left grey round>{{mcrozier:ain_trs_connection.jpg}}</box> \\ 
I use normalising (DPST) 6.5mm TRS Sockets. \\ 
Tip = +5 (vd)\\ 
Ring = CV (A#)\\ 
Sleeve = Ground (vs)\\ 


Ring and Sleeve are connected together on the normalising side. \\ 
When a jack is not inserted, CV connects straight to ground (prevents AIN jitter). \\ 
----
|{{mcrozier:pbx_core-trs_connection.jpg}}| \\ 
When inserting/removing a jack, make sure the control voltage = 0 (pedal off). Or you will pass voltage straight to ground, causing mios to crash, and maybe cause damage to the circuit. \\ 

//If your using manufactured expresion pedals or other cv devices, check the pin assignment, some devices use a different setup. \\ 
With different setups, there is no way of stopping +5 being passed straight to ground while inserting/removing the jack (that i know of). Make sure you power off first!!!//



====Buttons / Foot Switches====
Up to 34 buttons can be used with Pedal Board mode. \\ 
16 fixed buttons, 16 banked buttons, bank up and bank down \\ 

This gives a total of 144 possible midi commands.

The fixed buttons must be connected first (pin 0 up to 15), any amount 16 or less if fine (including none). \\ 
Fixed buttons are buttons numbers 1-16. \\ 

The banked buttons connect next (starting from the next available pin), again any number of banked buttons 16 or less is fine (including none). \\ 
They represent buttons 17-144. \\ 

The special function buttons pair up with bank down to access the setup menu's these can be any button aside from bank up or bank down. (pins defined in main.h)

How many of each type of button is defined in main.h.

The amount of banks available will vary with how many physical banked buttons you have. eg. with 2, there will be 64 banks, with 4 there will be 32 banks. \\ 
With 6 buttons there will be 22 banks. In bank 22, the first 2 buttons will represent button number 143 and 144, the 4 remaining will also represent 144. \\ 
If you don't have any banked buttons, bank display functions will also be disabled.



====Indicator LEDs====
Buttons can have indicator LEDs displaying their curent status. \\ 
LEDs connect to the first 1,2,3 or 4 shift registers, matching up with their DIN counterparts. \\
eg. SR1 DIN D0 = DOUT D7, DIN D1 = DOUT D6 \\ 







====7 Segment LED Digits====
2 seven segment LED digits can be connected to a DOUT module for bank display. \\ 
Pedal BoX does not use a LED matrix, each digit requires it's own shift register  \\ 

Connect digits to the shift registers after LEDs, so if you only use 4 leds, still start at SR2 (or pin 8) \\ 
|{{mcrozier:pbx_leddigits1.jpg}}| \\ 

0, 1 or 2 digits can be used (defined in main.h). If no digits are used, the current bank is displayed on the LCD, overwriting some of the usual first line.

At this time if indicator LED's are not required, you must still allow DOUT's for them if you plan to use LED digits. \\ 
Amount of LED's match the amount buttons of connected.

So if you use 5 fixed and 5 banked buttons, led digits must still connect to the 3rd and 4th shift register.

**Buttons, LEDs and LED Digits are only available for Pedal Board mode**







====Where to get Pedal Board parts====
I only built Pedal Box, so I use the Behringer FCV100 Foot Pedal in CV mode. But here's some links that came up on the forum.

  * stryd_one offered this google search for momentary footswitches. [[http://www.google.com.au/search?safe=off&q=momentary+SPST+footswitch]]
  * [[http://www.smallbearelec.com/|Small Bear Electronics]] Specializes in DIY guitar sound effects
  

If you build Pedal Board please FIXME













=====To Do - Future Plans=====

  * Add Patch system - for buttons to trigger up to 32 midi events simultainiously. Will also be available via MIDI program changes. (v2)
  * Add support for 8 relay's to switch amp circuits etc. To be triggered via new patch system (v2)
  * Support for 30 song/cue lists, to trigger a patch in a given order via cue next/previous buttons. (v2)
  * Vastly improve multiple device structure and usage. Max device's will be lowered to 7. the first bankstick will store pedal box/board info, such as patch's and song lists (v2) - will now require minimum of 2 x 24LC256 bankstick's.
  * Make everything customizable from the box (... v2 - maybe)
  * Add sysex implementation, so patch names can be downloaded from the device (v2 -- if ever)
  * Write more usage documentation
  * Write documentation on how to create your own setups for MIDI devices
  * Add support for other devices //need to expand// Any requests? (pm me in the forum)
  * Add IIC Midi module so feedback can be recieved from the device (if running in pedal box mode with separate floorboard)
  * Probably a lot more. I expect this will be an ongoing project

Version 2 is planned for release in early 2008.

At the moment uploading device information to the core is a little painful.

This is a call out to all keen programmers to write support for JSynthLib or create a perl script similar to the midibox64. I'm happy to work with anyone who's interested in the project.




======Inspirado======

Here's a vision I had: \\ 
{{mcrozier:pedal_board_max.jpg}}  \\ 
You know you want to build it!

======For Application Developers======
[[pedal_box:For_Developers]]